package cn.jingzhuan.element.demo.view.util

import android.app.Activity
import android.support.annotation.StyleRes


object ThemeUtil {

    fun configThemeBeforeOnCreate(activity: Activity, @StyleRes  defaultTheme: Int, @StyleRes customTheme: Int): Boolean {
        val enable = SettingShared.isEnableThemeDark(activity)
        activity.setTheme(if (enable) customTheme else defaultTheme)
        return enable
    }

    fun notifyThemeApply(activity: Activity) {
        HandlerUtils.handler.post(Runnable { activity.recreate() })
    }
}
